﻿Option Explicit On
Imports System.Runtime.InteropServices
'Imports System.Windows.Forms

Public Class frmMDIParent
    Implements IMessageFilter

    Public fWindows As New ArrayList
    Private m_ChildFormNumber As Integer
    Public RecentFile As New ArrayList

    Const WM_DROPFILES = &H233

    Public Sub ShowNewForm(ByVal IsStarting As Boolean, ByVal IsDropped As Boolean) 'Handles NewToolStripButton.Click, NewMenuItem.Click
        If IsStarting = False Then
            Dim ActiveForm As frmMain
            ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
            If ActiveForm.Text <> "无标题 - 新建INI文件" Then
                ' 创建此子窗体的一个新实例。
                Dim ChildForm As New frmMain 'lSystem.Windows.Forms.Form
                fWindows.Add(ChildForm)
                ' 在显示该窗体前使其成为此 MDI 窗体的子窗体。
                ChildForm.MdiParent = Me

                m_ChildFormNumber += 1
                ChildForm.Text = "无标题 - 新建INI文件" 'CStr(fWindows.Count)

                For Each Window As frmMain In fWindows
                    Window.Hide()
                Next

                tooSWind.Items.Add("无标题")

                ChildForm.Show()
            Else
                If IsDropped = False Then MsgBox("您已经打开一个无标题窗口，无需再次新建窗口。", MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "INI编辑器 V2 警告")
            End If
        Else
            ' 创建此子窗体的一个新实例。
            Dim ChildForm As New frmMain 'lSystem.Windows.Forms.Form
            fWindows.Add(ChildForm)
            ' 在显示该窗体前使其成为此 MDI 窗体的子窗体。
            ChildForm.MdiParent = Me

            m_ChildFormNumber += 1
            ChildForm.Text = "无标题 - 新建INI文件" 'CStr(fWindows.Count)

            For Each Window As frmMain In fWindows
                Window.Hide()
            Next

            tooSWind.Items.Add("无标题")

            ChildForm.Show()
        End If

    End Sub

    Public Sub NewForm() Handles NewToolStripButton.Click, NewMenuItem.Click
        ShowNewForm(False, False)
    End Sub

    Public Function GetRecentFileArray() As ArrayList

        Dim tmpArray As New ArrayList
        Dim tmpArray2 As New ArrayList
        Dim fs As New System.IO.FileStream(Application.StartupPath + "\Data\nProgramData.sdl", IO.FileMode.Open)
        Dim sr As New System.IO.StreamReader(fs, System.Text.Encoding.GetEncoding("GB2312"))
        Do Until Trim(sr.ReadLine) = "[RecentFile]"
            If sr.EndOfStream Then
                Dim empty As New ArrayList
                For i = 0 To 7
                    empty.Add("nothing")
                Next
                Return empty
            End If
            sr.ReadLine()
        Loop

        Dim currentLine As String = ""
        Do Until Trim(currentLine).StartsWith("[")
            If sr.EndOfStream Then Exit Do
            currentLine = sr.ReadLine
            If UBound(currentLine.Split("=")) = 1 Then
                tmpArray.Add(Trim(currentLine.Split("=")(1)))
            End If
        Loop

        sr.Close()
        fs.Close()

        If tmpArray.Count > 8 Then
            tmpArray2.AddRange(tmpArray)
            tmpArray.Clear()
            For i = 0 To 7
                tmpArray.Add(tmpArray2(i))
            Next
        End If

        Return tmpArray

    End Function

    Public Sub WriteProgramData()

        Dim sw As IO.StreamWriter = New IO.StreamWriter(Application.StartupPath + "\Data\nProgramData.sdl", False, System.Text.Encoding.GetEncoding("GB2312"))
        sw.WriteLine("[RecentFile]")

        For i = 0 To 7
            sw.WriteLine(CStr(i) & "=" & RecentFile(i))
        Next

        sw.Close()

    End Sub

    Public Sub RefreshRecentFileMenuItem()
        mnuRecentFile.DropDownItems.Clear()
        OpenToolButton.DropDownItems.Clear()
        For Each FileName As String In RecentFile
            If FileName <> "nothing" Then
                mnuRecentFile.DropDownItems.Add(FileName, picINI.Image)
                OpenToolButton.DropDownItems.Add(FileName, picINI.Image)
            End If
        Next
        If mnuRecentFile.DropDownItems.Count = 0 Then
            mnuRecentFile.Enabled = False
        Else
            mnuRecentFile.Enabled = True
            'mnuRecentFile.DropDown.ImageScalingSize = New System.Drawing.Size(128, 128)
        End If
        If OpenToolButton.DropDownItems.Count = 0 Then
            OpenToolButton.DropDown.Enabled = False
        Else
            OpenToolButton.DropDown.Enabled = True
        End If
        'mnuRecentFile.HasDropDownItems = True
    End Sub

    Public Sub EightNumberRFA()
        Dim tmpArray2 As New ArrayList
        If RecentFile.Count > 8 Then
            tmpArray2.AddRange(RecentFile)
            RecentFile.Clear()
            For i = 0 To 7
                RecentFile.Add(tmpArray2(i))
            Next
        End If
    End Sub

    Public Sub OpenINIWithTextEditor() Handles OpenINIWTEButton.Click

        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        If ActiveForm.currentFile <> "" And ActiveForm.currentFile <> Nothing Then
            If ActiveForm.Modifyed = True Then
                Dim sFMsg As MsgBoxResult
                sFMsg = MsgBox("您的修改尚未保存，要保存么？", MsgBoxStyle.YesNoCancel + MsgBoxStyle.Information, "INI编辑器 V2 警告")
                If sFMsg = MsgBoxResult.Cancel Then
                    Exit Sub
                ElseIf sFMsg = MsgBoxResult.Yes Then
                    ActiveForm.SaveCurrentINI()
                End If
            End If
            ShellExecute(Me.Handle.ToInt32, vbNullString, ActiveForm.currentFile, vbNullString, vbNullString, 1)
        End If

    End Sub

    Private Sub frmMDIParent_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        WriteProgramData()
    End Sub

    Private Sub frmMDIParent_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = "INI文件通用编辑器 by SecondDatke 2011 Version " + VersionString
        ShowNewForm(True, False)

        Application.AddMessageFilter(Me)
        DragAcceptFiles(Me.Handle.ToInt32, True)

        stlVersion.Text = "Version " + VersionString
        RecentFile = GetRecentFileArray()
        RefreshRecentFileMenuItem()

        'Dim a As New frmMDIParent
        'picINI.SendToBack()
        'SetParent(picINI.Handle.ToInt32, a.Handle.ToInt32)
        'picINI.BackColor = Color.Transparent
    End Sub

    Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ExitMenuItem.Click
        Me.Close()
        Application.Exit()
    End Sub

    Private Sub ToolBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ToolBarToolStripMenuItem.Click
        Me.toolMain.Visible = Me.ToolBarToolStripMenuItem.Checked
    End Sub

    Private Sub StatusBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles StatusBarToolStripMenuItem.Click
        Me.StatusStrip.Visible = Me.StatusBarToolStripMenuItem.Checked
    End Sub

    Private Sub 语句翻译栏ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TVMenuItem.Click
        Me.StatusStrip2.Visible = Me.TVMenuItem.Checked
    End Sub

    Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CloseAllToolStripMenuItem.Click
        ' 关闭此父窗体的所有子窗体。
        For Each ChildForm As Form In Me.MdiChildren
            ChildForm.Show()
            ChildForm.Close()
        Next
    End Sub

    Private Sub tooSWind_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tooSWind.DoubleClick
        Me.ActiveMdiChild.Close()
    End Sub

    Private Sub tooSWind_ItemAdded(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemEventArgs) Handles tooSWind.ItemAdded
        'For Each Item In tooSWind.Items
        'If e.Item.Equals(Item) Then
        'Item = New System.Windows.Forms.ToolStripButton
        'Item.CheckOnClick = True
        'Item.Checked = True
        'Exit For
        'End If
        'Next
    End Sub

    Private Sub tooWid01_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles tooSWind.ItemClicked
        'tooWid01

        If e.ClickedItem.Name <> "NewToolStripButton" Then

            Dim Windex As Integer = 0

            For Each Window As frmMain In fWindows
                Window.Hide()
            Next

            For Each Item As ToolStripItem In tooSWind.Items
                'If Item.Name <> "NewToolStripButton" Then
                If e.ClickedItem.Equals(Item) Then
                    Exit For
                End If
                Windex = Windex + 1
                'End If
            Next

            'fWindows(Windex).Show()
            fWindows(Windex).Show()

        End If

    End Sub

    Private Sub 打开OToolStripButton_ButtonClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles OpenToolButton.ButtonClick
        If Me.ActiveMdiChild Is Nothing Then ShowNewForm(False, True)
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
        If ActiveForm.Text <> "无标题 - 新建INI文件" Then ShowNewForm(False, False)
        ActiveForm.LoadFile(0)
    End Sub

    Private Sub OpenMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenMenuItem.Click
        If Me.ActiveMdiChild Is Nothing Then ShowNewForm(False, True)
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
        If ActiveForm.Text <> "无标题 - 新建INI文件" Then ShowNewForm(False, False)
        ActiveForm.LoadFile(0)
    End Sub

    Private Sub 剪切UToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 剪切UToolStripButton.Click, CutMenuItem.Click

        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        If ActiveForm.rtfText.Focused Then
            ActiveForm.rtfText.Cut()

            Dim cText As String
            cText = Clipboard.GetText(TextDataFormat.UnicodeText)
            If cText.IndexOf(vbCrLf) >= 0 Or cText.IndexOf(vbLf) >= 0 Then cText = vbCrLf + cText

            ActiveForm.iClipboard.Add(cText)
            ActiveForm.CheckClipboardArray()
            ActiveForm.CheckParentFormClipboardList()
        End If

    End Sub

    Private Sub 复制CToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 复制CToolStripButton.Click, CopyMenuItem.Click

        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        If ActiveForm.rtfText.Focused Then
            ActiveForm.rtfText.Copy()

            Dim cText As String
            cText = Clipboard.GetText(TextDataFormat.UnicodeText)
            If cText.IndexOf(vbCrLf) >= 0 Or cText.IndexOf(vbLf) >= 0 Then cText = vbCrLf + cText

            ActiveForm.iClipboard.Add(cText)
            ActiveForm.CheckClipboardArray()
            ActiveForm.CheckParentFormClipboardList()
        End If

    End Sub

    Private Sub 粘贴PToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 粘贴PToolStripButton.Click, PasteMenuItem.Click
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        If ActiveForm.rtfText.Focused Then
            ActiveForm.rtfText.Paste()
        End If
    End Sub

    Private Sub 撤消UToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 撤消UToolStripMenuItem.Click
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        If ActiveForm.rtfText.Focused Then
            ActiveForm.rtfText.Undo()
        End If
    End Sub

    Private Sub 重复RToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 重复RToolStripMenuItem.Click
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        If ActiveForm.rtfText.Focused Then
            ActiveForm.rtfText.Redo()
        End If
    End Sub

    Private Sub 全选AToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 全选AToolStripMenuItem.Click
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        If ActiveForm.rtfText.Focused Then
            ActiveForm.rtfText.SelectAll()
        End If
    End Sub

    Private Sub 保存SToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 保存SToolStripButton.Click, SaveMenuItem.Click
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
        ActiveForm.SaveCurrentINI()
    End Sub

    Private Sub SaveAsButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAsMenuItem.Click
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
        ActiveForm.SaveINI()
    End Sub

    Private Sub AboutButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutButton.Click, AboutToolStripMenuItem.Click
        frmAbout.Show()
    End Sub

    Private Sub mnuRecentFile_DropDownItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles mnuRecentFile.DropDownItemClicked
        ShowNewForm(False, True)
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
        ActiveForm.LoadFile(1, e.ClickedItem.Text)
    End Sub

    <DllImport("shell32.dll")> Public Shared Sub DragFinish(ByVal hDrop As Integer)

    End Sub

    <DllImport("shell32.dll")> Public Shared Sub DragAcceptFiles(ByVal hwnd As Integer, ByVal fAccept As Boolean)

    End Sub

    <DllImport("shell32.dll")> Public Shared Function DragQueryFile(ByVal HDROP As Integer, ByVal UINT As Integer, ByVal lpStr As System.Text.StringBuilder, ByVal ch As Integer) As Integer

    End Function

    '<DllImport("user32.dll")> Friend Shared Function SetParent(ByVal hWndChild As Integer, ByVal hWndNewParent As Integer) As Integer

    'End Function

    Function PreFilterMessage(ByRef m As Message) As Boolean Implements IMessageFilter.PreFilterMessage
        If m.Msg = WM_DROPFILES Then
            '设置拖放的动作
            Dim nfiles As Int16
            nfiles = DragQueryFile(m.WParam.ToInt32, -1, Nothing, 0)
            Dim i As Int16
            Dim sb As New System.Text.StringBuilder(256)
            Dim sFirstFileName As String '记录第一个文件名

            'TextBox1.Clear()

            For i = 0 To nfiles - 1
                DragQueryFile(m.WParam.ToInt32, i, sb, 256)
                If i = 0 Then sFirstFileName = sb.ToString
                'TextBox1.AppendText(ControlChars.CrLf & sb.ToString)
            Next

            DragFinish(m.WParam.ToInt32) '拖放完成

            '显示文件内容
            'Dim fs As New System.IO.FileStream(sFirstFileName, IO.FileMode.Open)
            'Dim sr As New System.IO.StreamReader(fs, System.Text.Encoding.GetEncoding("gb2312"))
            'TextBox1.AppendText(ControlChars.CrLf & sr.ReadToEnd().ToString)
            If sFirstFileName <> Nothing Then
                ShowNewForm(False, True)
                Dim ActiveForm As frmMain
                ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
                ActiveForm.LoadFile(2, sFirstFileName)
            End If

        End If
        Return False
    End Function

    Private Sub ModEncButton1_Click() Handles SearchToolStripMenuItem1.Click

        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        If ActiveForm.currentFile <> "" And ActiveForm.currentFile <> Nothing Then
            Dim url As String
            url = "http://modenc.renegadeprojects.com/Main_Page?title=Special%3ASearch&search=" + ActiveForm.GetCurrentWord.WordContext + "&fulltext=Search"
            ShellExecute(Me.Handle.ToInt32, vbNullString, url, vbNullString, vbNullString, 1)
        End If

    End Sub

    Private Sub GoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToolStripMenuItem1.Click

        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        If ActiveForm.currentFile <> "" And ActiveForm.currentFile <> Nothing Then
            Dim url As String
            url = "http://modenc.renegadeprojects.com/" + ActiveForm.GetCurrentWord.WordContext
            ShellExecute(Me.Handle.ToInt32, vbNullString, url, vbNullString, vbNullString, 1)
        End If

    End Sub

    Private Sub ModEncButton1_ButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ModEncButton1.ButtonClick
        ModEncButton1_Click()
    End Sub

    Private Sub ModEncButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchToolStripMenuItem1.Click

    End Sub

    Private Sub OpenINIWithTextEditor(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenINIWTEButton.Click

    End Sub

    Private Sub NewForm(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripButton.Click, NewMenuItem.Click

    End Sub

    Private Sub imgOpenFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles imgOpenFolder.Click, cmdOF.Click
        Dim tmpArray As String()
        Dim tmpStr As String = ""
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
        If ActiveForm.currentFile <> "" And ActiveForm.currentFile <> Nothing Then
            tmpArray = ActiveForm.currentFile.Split("\")
            For i = 0 To UBound(tmpArray) - 1
                tmpStr = tmpStr + tmpArray(i) + "\"
            Next
            'MsgBox(tmpStr)
            ShellExecute(Me.Handle.ToInt32, vbNullString, tmpStr, vbNullString, vbNullString, 1)
        End If
    End Sub

    Private Sub lstClipboard_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstClipboard.DoubleClick

        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)

        Clipboard.SetText(lstClipboard.SelectedItem.ToString, TextDataFormat.UnicodeText)
        ActiveForm.rtfText.Focus()
        ActiveForm.rtfText.Select()
        ActiveForm.rtfText.Paste()

    End Sub

    Private Sub cmdCopySection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCopySection.Click, cmdCS2.Click
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
        If ActiveForm.currentFile <> "" And ActiveForm.currentFile <> Nothing Then
            frmCSection.Show()
        End If
    End Sub

    Private Sub 查找FToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 查找FToolStripMenuItem.Click
        FindDialog.Show()
    End Sub

    Public Sub OpenURL(ByVal URL As String)
        ShellExecute(Me.Handle.ToInt32, vbNullString, URL, vbNullString, vbNullString, 1)
    End Sub

    Private Sub RA2DIY论坛ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RA2DIY论坛ToolStripMenuItem.Click
        OpenURL("http://bbs.ra2diy.com/")
    End Sub

    Private Sub PPMForumsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PPMForumsToolStripMenuItem.Click
        OpenURL("http://www.ppmsite.com/")
    End Sub

    Private Sub Ares官网ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ares官网ToolStripMenuItem.Click
        OpenURL("http://ares.strategy-x.com/")
    End Sub

    Private Sub ModEncToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ModEncToolStripMenuItem.Click
        OpenURL("http://modenc.renegadeprojects.com/")
    End Sub

    Private Sub CnCSourceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CnCSourceToolStripMenuItem.Click
        OpenURL("http://www.cnc-source.com/")
    End Sub

    Private Sub ModDBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ModDBToolStripMenuItem.Click
        OpenURL("http://www.moddb.com/mods")
    End Sub

    Private Sub 透明的向往吧ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 透明的向往吧ToolStripMenuItem.Click
        OpenURL("http://tieba.baidu.com/f?kw=%CD%B8%C3%F7%B5%C4%CF%F2%CD%F9")
    End Sub

    Private Sub 尤里Mod吧ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 尤里Mod吧ToolStripMenuItem.Click
        OpenURL("http://tieba.baidu.com/f?kw=%D3%C8%C0%EFmod")
    End Sub

    Private Sub 心灵终结吧ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 心灵终结吧ToolStripMenuItem.Click
        OpenURL("http://tieba.baidu.com/f?kw=%D0%C4%C1%E9%D6%D5%BD%E1")
    End Sub

    Private Sub 红色警戒吧ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 红色警戒吧ToolStripMenuItem.Click
        OpenURL("http://tieba.baidu.com/f?kw=%BA%EC%C9%AB%BE%AF%BD%E4")
    End Sub

    Private Sub 尤里复制人X吧ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 尤里复制人X吧ToolStripMenuItem.Click
        OpenURL("http://tieba.baidu.com/f?kw=%D3%C8%C0%EF%B8%B4%D6%C6%C8%CBx")
    End Sub

    Private Sub 红色赛宁吧ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 红色赛宁吧ToolStripMenuItem.Click
        OpenURL("http://tieba.baidu.com/f?kw=%BA%EC%C9%AB%C8%FC%C4%FE")
    End Sub

    Private Sub 心灵终结官网ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 心灵终结官网ToolStripMenuItem.Click
        OpenURL("http://mo.cncguild.net/")
    End Sub

    Private Sub 征服者ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 征服者ToolStripMenuItem.Click
        OpenURL("http://mycnc.org")
    End Sub

    Private Sub 电驴VeryCDToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 电驴VeryCDToolStripMenuItem.Click
        OpenURL("http://www.verycd.com/")
    End Sub

    Private Sub 电脑爱好者论坛ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 电脑爱好者论坛ToolStripMenuItem.Click
        OpenURL("http://bbs.cfan.com.cn/index.php")
    End Sub

    Private Sub MSDNToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MSDNToolStripMenuItem.Click
        OpenURL("http://msdn.microsoft.com/zh-cn/default")
    End Sub

    Private Sub YRMOD吧网盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles YRMOD吧网盘ToolStripMenuItem.Click
        OpenURL("http://yrmod-tools.ys168.com/")
    End Sub

    Private Sub 朲的主盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 朲的主盘ToolStripMenuItem.Click
        OpenURL("http://laby.ys168.com/")
    End Sub

    Private Sub 我要自学网3DSMAX基础ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 我要自学网3DSMAX基础ToolStripMenuItem.Click
        OpenURL("http://www.51zxw.net/list.aspx?cid=15")
    End Sub

    Private Sub 作者的网盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 作者的网盘ToolStripMenuItem.Click
        OpenURL("http://secondwtq.ys168.com")
    End Sub

    Private Sub LHMouse的小黑屋ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LHMouse的小黑屋ToolStripMenuItem.Click
        OpenURL("http://lh-mouse.ys168.com/")
    End Sub

    Private Sub Nuke的网盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nuke的网盘ToolStripMenuItem.Click
        OpenURL("http://gabriella.ys168.com/")
    End Sub

    Private Sub 心灵终结吧网盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 心灵终结吧网盘ToolStripMenuItem.Click
        OpenURL("http://mentalomega.ys168.com/")
    End Sub

    Private Sub CnCGuildToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CnCGuildToolStripMenuItem.Click
        OpenURL("http://cncguild.net/")
    End Sub

    Private Sub CnCTop101ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CnCTop101ToolStripMenuItem.Click
        OpenURL("http://topsite.cnccommunity.net/index.php")
    End Sub

    Private Sub RevoraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RevoraToolStripMenuItem.Click
        OpenURL("http://revora.net/")
    End Sub

    Private Sub DEShine的网盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DEShine的网盘ToolStripMenuItem.Click
        OpenURL("http://654813782.ys168.com/")
    End Sub

    Private Sub 欢译鸡的网盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 欢译鸡的网盘ToolStripMenuItem.Click
        OpenURL("http://kimjongii.ys168.com/")
    End Sub

    Private Sub 尤里复制人X的网盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 尤里复制人X的网盘ToolStripMenuItem.Click
        OpenURL("http://7cyclone.ys168.com/")
    End Sub

    Private Sub ZY的网盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZY的网盘ToolStripMenuItem.Click
        OpenURL("http://zy1998320.ys168.com/")
    End Sub

    Private Sub 赛宁的网盘ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 赛宁的网盘ToolStripMenuItem.Click
        OpenURL("http://redshining.ys168.com/")
    End Sub

    Private Sub 时间的逆转ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 时间的逆转ToolStripMenuItem.Click
        OpenURL("http://547749085.ys168.com/")
    End Sub

    Private Sub CNC部落ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CNC部落ToolStripMenuItem.Click
        OpenURL("http://cnc-cn.5d6d.com/")
    End Sub

    Private Sub 任务之家ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 任务之家ToolStripMenuItem.Click
        OpenURL("http://www.pkuit.com/")
    End Sub

    Private Sub OpenToolButton_DropDownItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles OpenToolButton.DropDownItemClicked
        ShowNewForm(False, True)
        Dim ActiveForm As frmMain
        ActiveForm = DirectCast(Me.ActiveMdiChild, frmMain)
        ActiveForm.LoadFile(1, e.ClickedItem.Text)
    End Sub

End Class
